﻿<UserControl x:Class="PocoGen.Gui.Presentation.Views.ColumnNameGeneratorConfigurationView"
             x:ClassModifier="internal"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <CollectionViewSource x:Key="columnNameGenerators" Source="{Binding AvailableColumnNameGenerators}">
            <CollectionViewSource.SortDescriptions>
                <scm:SortDescription PropertyName="Name" />
            </CollectionViewSource.SortDescriptions>
        </CollectionViewSource>

        <Style TargetType="Label">
            <Setter Property="VerticalAlignment" Value="Center" />
        </Style>
        <Style TargetType="ComboBox">
            <Setter Property="Margin" Value="2" />
        </Style>
        <Style TargetType="TextBlock">
            <Setter Property="Margin" Value="2" />
        </Style>
        <Style TargetType="Button">
            <Setter Property="Margin" Value="2" />
            <Setter Property="Padding" Value="5" />
        </Style>
    </UserControl.Resources>

    <DockPanel>
        <DockPanel DockPanel.Dock="Top">
            <Label DockPanel.Dock="Left" VerticalAlignment="Center">Available Property name generators:</Label>
            <Button DockPanel.Dock="Right" Command="{Binding Add}" UseLayoutRounding="True" ToolTip="Add" VerticalAlignment="Center" Padding="2">
                <Image Source="{StaticResource AddIcon}" Stretch="None" Height="16" />
            </Button>

            <ComboBox ItemsSource="{Binding Source={StaticResource columnNameGenerators}}" DisplayMemberPath="Name" SelectedItem="{Binding SelectedColumnNameGeneratorToAdd}" />
        </DockPanel>

        <ListBox ItemsSource="{Binding ColumnNameGenerators}" ItemContainerStyle="{StaticResource ListBoxWithNoSelection}" HorizontalContentAlignment="Stretch" VirtualizingPanel.VirtualizationMode="Recycling" />
    </DockPanel>
</UserControl>
